<template>
	<view class="pagebox">
	<view class="searhcbox">
		<input type="text" placeholder="请输入专家/症状/科室/医院" v-model="searchvalue" />
		<view class="searchbtn" @click="search">
			搜索
		</view>
	</view>

	
	<view class="listbox">
		<view class="itemlist" v-for="item in list " :key="item.id" @click="goaizixun(item)">
			<view class="infobox">
				<view class="imgbox">
					<image :src="'https://changban.dianjingkeji.net'+item.davatarUrl" mode=""></image>
				</view>
				<view class="info">
					
					<view class="nameline">
						<view class="name">
							{{item.dname}}
						</view>
						<view class="keshi">
							{{item.dkeshi}}
						</view>
					</view>
					<view class="hospitalname">
						{{item.orgName}}
					</view>
					<view class="zhichengline">
						<view class="itemzhicheng">
							{{item.dzhicheng}}
						</view>
					</view>
				</view>
			</view>
			<!-- <view class="tabline">
				<view class="itemtab">
					<view class="iconfont icon-rengong">
						
					</view>
					在线咨询
				</view>
				<view class="itemtab">
					<view class="iconfont icon-fuwu1" style="color: #7BE1B0;">
						
					</view>
				   更多服务
				</view>
			</view> -->
		</view>
	</view>
	</view>
</template>

<script>
	import {getDoctorListByRole,doctorInvitationJoinTeam} from '../../utils/api.js'
	export default {
		data() {
			return {
				searchvalue:'',
				address:'',
				teamid:'',
				roleid:'',
				list:[]
			}
		},
		onLoad(e) {
			this.teamid=e.tid
			this.roleid=e.roleid
			if(e.roleid==0){
				uni.setNavigationBarTitle({
				   title: '领衔专家'
				 })
			}
			if(e.roleid==1){
				uni.setNavigationBarTitle({
				   title: '联席专家'
				 })
			}
			if(e.roleid==2){
				uni.setNavigationBarTitle({
				   title: '主管医生'
				 })
			}
			if(e.roleid==3){
				uni.setNavigationBarTitle({
				   title: '主管护士'
				 })
			}
			if(e.roleid==4){
				uni.setNavigationBarTitle({
				   title: '6X健康管家'
				 })
			}
			let p={
				phone:uni.getStorageSync('phone'),
				role:e.roleid,
				selectValue:this.searchvalue
			}
			getDoctorListByRole(p).then(res=>{
				console.log(res,'医生列表')
				this.list=res.data.data
			})
		
		},
		methods: {
			search(){
				let p={
					phone:uni.getStorageSync('phone'),
					role:this.roleid,
					selectValue:this.searchvalue
				}
				getDoctorListByRole(p).then(res=>{
					console.log(res,'医生列表')
					this.list=res.data.data
				})
			},
			goaizixun(e){
				console.log(e)
				let that=this
				uni.showModal({
					title: '提示',
					content: '邀请加入团队',
					success: function (res) {
						if (res.confirm) {
							let p={
								phone:uni.getStorageSync('phone'),
								teamId:that.teamid,
								hdId:e.id,
								role:that.roleid
							}
							doctorInvitationJoinTeam(p).then(res=>{
								console.log(res)
								if(res.data.code==200){
									uni.showToast({
										title: '已发送邀请',
										duration: 2000
									});
									setTimeout(()=>{
										uni.navigateBack()
									},2000)

								}else{
									uni.showToast({
										title: res.data.msg,
										icon:'none',
										duration: 3000
									});
								}
							})
							console.log('用户点击确定');
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});

			},
		}
	}
</script>

<style lang="less">
.pagebox{
	width: 750rpx;
	box-sizing: border-box;
	padding: 30rpx;
	background: linear-gradient(180deg, rgba(242,248,255,1) 0%,rgba(255,255,255,0) 76%);
	.searhcbox{
			  width: 92%;
			  display: flex;
			  align-items: center;
			  height: 70rpx;
			  line-height: 70rpx;
			  border-radius: 35rpx;
			  margin: auto;
			  border: 1rpx solid #1a4f8a;
			  input{
				  width: 80%;
				  height: 70rpx;
				  padding: 0 10rpx;
				  
			  }
			  .searchbtn{
				  width: 20%;
				  background-color: white;
	              text-align: center;
				 line-height: 70rpx;
				 border-radius: 35rpx;
			  }
	}
	.line{
		width: 100%;
		display: flex;
		align-items: center;
	}
	.addressbox{
		width: 200rpx;
		height: 50rpx;
		margin: 20rpx;
		background-color: #F3E8FD ;
		border-radius: 10rpx;
		picker{
			width: 200rpx;
			height: 200rpx;
			
		}
		.picker{
			width: 200rpx;
			height: 200rpx;
			text-align: center;
			
			
		}
	}
	.listbox{
				  width: 100%;
				  
				  box-sizing: border-box;
				 
				  .itemlist{
					  width: 100%;
					  margin-bottom: 30rpx;
					  border-radius: 20rpx;
					  background-color: white;
					   padding: 20rpx;
					   box-sizing: border-box;
					  .infobox{
						  display: flex;
						  align-items: center;
						  .imgbox{
							  width: 170rpx;
							  height: 200rpx;
							  border-radius: 10rpx;
							  margin-right: 20rpx;
							  image{
								  width: 100%;
								  height: 100%;
								  border-radius: 10rpx;
							  }
						  }
						  .info{
							flex: 1;
							line-height: 2.5;
							.nameline{
								display: flex;
								align-items: center;
								position: relative;
								.iconfont{
									position: absolute;
									right: 10rpx;
									top: 0;
									color:#D2D2D2 ;
									display: flex;
									align-items: center;
									view{
										font-size: 24rpx;
										color: black;
									}
									
								}
								.name{
									font-weight: bold;
									margin-right: 20rpx;
								}
							}
							.hospitalname{
								font-size: 24rpx;
								padding: 2rpx 30rpx;
								border-radius: 10rpx;
								
							}
							.zhichengline{
								display: flex;
								align-items: center;
								.itemzhicheng{
									font-size: 22rpx;
									color: #B16A00 ;
									background-color: #FFF6EB ;
									padding: 10rpx 30rpx;
										border-radius: 10rpx;
								}
								
							}
							
						  }
					  }
					  .tabline{
						  width: 100%;
						  display: flex;
						  margin-top: 20rpx;
						  align-items: center;
						  justify-content: space-evenly;
						  .itemtab{
							  display: flex;
							  align-items: center;
							  color: #898989 ;
							  .iconfont{
								  font-size: 40rpx;
								  color: #BF63FF ;
								  margin-right: 20rpx;
							  }
						  }
					  }
				  }
				  
	}
}
</style>
